export var setCookie = function (name,value,day) {
   if (day !==0) {
      var expires = day * 24 * 3600 * 1000 ;
      var date = new Date(+new Date() + expires) ;
      document.cookie = name + '=' + escape(value) + ';expires=' + date.toUTCString() ; 
   } else {
      document.cookie = name + '=' + escape(value);
   }
}

export var getCookie = function (name) {
   var arr ;
   var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)');
   if (arr = document.cookie.match(reg)) {
      return unescape(arr[2])
   } else {
      return null ;
   }
}

export var delCookie = function (name) {
   setCookie(name,' ' , -1);
}
